package com.meida.module.bbs.provider.handler;

import com.meida.common.base.entity.EntityMap;
import com.meida.common.mybatis.interceptor.PageInterceptor;
import com.meida.common.mybatis.model.PageParams;
import com.meida.common.mybatis.model.ResultBody;
import com.meida.common.mybatis.query.CriteriaQuery;
import com.meida.common.security.OpenHelper;
import com.meida.module.bbs.client.entity.BbsContent;
import org.springframework.stereotype.Component;

/**
 * 帖子列表
 *
 * @author zyf
 */
@Component("bbsContentListHandler")
public class BbsContentListHandler implements PageInterceptor<BbsContent> {


    @Override
    public ResultBody validate(CriteriaQuery cq, EntityMap params) {
        return ResultBody.ok();
    }

    @Override
    public void prepare(CriteriaQuery cq, PageParams pageParams, EntityMap params) {
        Long userId = OpenHelper.getUserId();
        cq.addSelect("collecon_tag(1,'BbsContent',contentId," + userId + ") scTag");
        cq.addSelect("collecon_tag(2,'BbsContent',contentId," + userId + ") dzTag");
    }


}
